// <copyright file="IProductService.cs" company="EnterpriseApi">
// Copyright (c) EnterpriseApi. All rights reserved.
// </copyright>

using EnterpriseApi.Models;

namespace EnterpriseApi.Services;

/// <summary>
/// 产品服务接口，定义产品特有的业务逻辑操作
/// </summary>
public interface IProductService : IService<Product>
{
    /// <summary>
    /// 根据类别获取产品列表
    /// </summary>
    /// <param name="categoryId">类别ID</param>
    /// <returns>特定类别的产品集合</returns>
    Task<IEnumerable<Product>> GetProductsByCategoryAsync(int categoryId);

    /// <summary>
    /// 获取可用产品列表
    /// </summary>
    /// <returns>可用产品集合</returns>
    Task<IEnumerable<Product>> GetAvailableProductsAsync();

    /// <summary>
    /// 根据价格范围获取产品
    /// </summary>
    /// <param name="minPrice">最低价格</param>
    /// <param name="maxPrice">最高价格</param>
    /// <returns>价格范围内的产品集合</returns>
    Task<IEnumerable<Product>> GetProductsByPriceRangeAsync(decimal minPrice, decimal maxPrice);

    /// <summary>
    /// 搜索产品（按名称或描述）
    /// </summary>
    /// <param name="searchTerm">搜索关键词</param>
    /// <returns>符合搜索条件的产品集合</returns>
    Task<IEnumerable<Product>> SearchProductsAsync(string searchTerm);

    /// <summary>
    /// 更新产品库存
    /// </summary>
    /// <param name="productId">产品ID</param>
    /// <param name="quantity">要增加或减少的数量（负数表示减少）</param>
    /// <returns>更新是否成功</returns>
    Task<bool> UpdateProductStockAsync(int productId, int quantity);

    /// <summary>
    /// 检查产品库存是否足够
    /// </summary>
    /// <param name="productId">产品ID</param>
    /// <param name="quantity">所需数量</param>
    /// <returns>库存是否足够</returns>
    Task<bool> CheckStockAvailabilityAsync(int productId, int quantity);
}